#ifndef ADDNEWDEVICE_H
#define ADDNEWDEVICE_H

#include <QDialog>
#include <QLineEdit>
#include <QRegExp>
#include <QRegExpValidator>

#include "global.h"
#include "custommessagebox.h"

namespace Ui {
class AddNewDevice;
}

class AddNewDevice : public QDialog
{
    Q_OBJECT

public:
    explicit AddNewDevice(QWidget *parent = nullptr);
    ~AddNewDevice();

    /* 新设备 */
    struct DeviceStruct {
        int deviceId;
        QString deviceName;
        QString MACAddr;
        QString IPAddr;
        QString Port;
        QString serialNumber;
        QString deviceStatus;
    };
    DeviceStruct deviceInfo;

public slots:
    void getNewDeviceInfo();

signals:
    void newDeviceInfo(AddNewDevice::DeviceStruct);

private:
    Ui::AddNewDevice *ui;

private:
    void setDataValidator(QLineEdit *obj, QString text, int max);
    void closeEvent(QCloseEvent *);

private:
    CustomMessageBox *cusBox;

};

#endif // ADDNEWDEVICE_H
